<template>
    <div class="containers">
        <div class="title">
            <span>当前综合值排名:{{ranking}}</span>
        </div>
        <div class="echarts"></div>
        <div class="bottom">
            <ul>
                <li class="c_e93636">{{num.num1}}</li>
                <li>客户总数</li>
            </ul>
            <ul>
                <li class="c_e93636">{{num.num2}}</li>
                <li>跟进总数</li>
            </ul>
            <ul>
                <li class="c_e93636">{{num.num3}}</li>
                <li>咨询总数</li>
            </ul>
        </div>
    </div>
</template>

<script>
let echarts = require("../../../node_modules/echarts/lib/echarts");
require("../../../node_modules/echarts/lib/chart/radar");

import Common from "../../assets/js/common.js";
let Mycommon = new Common();

export default {
  props: ['ranking','radarData','id'],
  data() {
    return {
      num:{
        num1:'',
        num2:'',
        num3:'',
      }
    };
  },
  created(){
     this.radarDatas()
  },
  mounted() {
    let echarts = this.echarts();
  },
  methods: {
    radarDatas() {
      let that = this
      let url = "BossStaffNumber";
      let data = {
        staff_id:this.id
      }
      Mycommon.http({
        url: url,
        data: data,
        success(res) {
          // console.log(that.num)
            that.num.num1 = res.data.data.client
            that.num.num2 = res.data.data.mark
            that.num.num3 = res.data.data.chat
            
        }
      });
    },
    echarts() {
      // 基于准备好的dom，初始化echarts实例
      let myChart = echarts.init(document.getElementsByClassName("echarts")[0]);
      // 绘制图表
      let option = {
        radar: [
          {
            indicator: this.radarData.title,
            center: ["50%", "50%"],
            radius: "70%",
            axisLine: {
              lineStyle: {
                color: "#e6e6e6"
              }
            },
            splitLine: {
              lineStyle: {
                color: "#e6e6e6"
              }
            }
          }
        ],
        series: [
          {
            symbol: "none",
            type: "radar",
            itemStyle: {
              color: "#fff"
            },
            data: [
              {
                value: this.radarData.datas||this.radarData.data,
                name: "某软件"
              }
            ],
            lineStyle: {
              color: "#fff"
            },
            areaStyle: { type: "default", color: "#ef5858" }
          }
        ]
      };
      myChart.setOption(option);
    }
  }
};
</script>
<style scoped>
.c_e93636{
    color:#e93636;
}
.containers {
  width: 100vw;
  min-height: 800px;
  background: #fff;
  font-size: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.title {
  width: 92vw;
  height: 100px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.echarts{
    width:100vw;
    height:500px;
}
.bottom{
    height:200px;
    width:100vw;
    display: flex;
    justify-content: space-around;
    align-items: center;
}
.bottom ul{
    display: flex;
    flex-direction: column;
    align-items: center;
}
</style>
